package cloud.shyidong.core.service;

import cloud.shyidong.core.dao.BaseDao;
import cloud.shyidong.core.entity.BaseEntity;
import cloud.shyidong.core.request.*;
import cloud.shyidong.core.response.PageResponse;

import java.util.List;
import java.util.Map;

/**
 * @Description TODO
 * @Author syd
 * @Date 2023/3/27
 */
public interface BaseService<D extends BaseDao, T extends BaseEntity, ID extends IdRequest, IQ extends InsertRequest, UQ extends UpdateRequest, PQ extends PageRequest> {
    
    void beforeInsert(IQ insertRequest);
    
    T insert(IQ insertRequest);
    
    void processInsert(IQ insertRequest, T t);
    
    void afterInsert(IQ insertRequest, T t);
    
    void beforeUpdate(UQ updateRequest);
    
    T update(UQ updateRequest);
    
    void processUpdate(UQ updateRequest, T t);
    
    void afterUpdate(UQ updateRequest, T t);
    
    void beforeDelete(ID idRequest);
    
    T delete(ID idRequest);
    
    void afterDelete(ID idRequest, T t);
    
    Map<String, Object> deletes(IdsRequest<ID> idsRequest);
    
    void beforeEnable(ID idRequest);
    
    T enable(ID idRequest);
    
    void afterEnable(ID idRequest, T t);
    
    Map<String, Object> enables(IdsRequest<ID> idsRequest);
    
    void beforeDisable(ID idRequest);
    
    T disable(ID idRequest);
    
    void afterDisable(ID idRequest, T t);
    
    Map<String, Object> disables(IdsRequest<ID> idsRequest);
    
    void beforeUp(ID idRequest);
    
    T up(ID idRequest);
    
    void afterUp(ID idRequest, T t);
    
    Map<String, Object> ups(IdsRequest<ID> idsRequest);
    
    void beforeDown(ID idRequest);
    
    T down(ID idRequest);
    
    void afterDown(ID idRequest, T t);
    
    Map<String, Object> downs(IdsRequest<ID> idsRequest);
    
    Map<String, Object> view(ID idRequest);
    
    List<T> search(PQ pageRequest);
    
    PageResponse<Map<String, Object>> page(PQ pageRequest);
    
}
